Trace / Impact DXL for Internal Links Only

G'Day Forum...I'm trying to get my hands on a trace and impact analysis DXL script that only considers those links that have been created internally to a module. I don't want to see where traces have been established external to a module / between modules. Does anyone have a DXL that does this or know what the script should look like?

Cheers
NickThiele - Sun Mar 13 23:56:59 EDT 2011

Re: Trace / Impact DXL for Internal Links Only
SystemAdmin - Mon Mar 14 00:54:36 EDT 2011

2 options I can think of for you to consider - both focus on finding the source of an outgoing link where the target of the link is internal to the current module.

1. If you have been using linkset rules to direct all internal links to a specific link module - then you could use code like the following.
 

Module    m = current
Object  sourceObj, targetObj
Link    l
string  internalLinkModName = "<enter full path and name of link module here>"
 
for sourceObj in m do { //for all visible objects (display set) in the current module
 
        for l in all (sourceObj->internalLinkModName) do { //for all out going links that go through a specific link module
                targetObj = target l
                print "Source of Internal Link: " identifier(sourceObj) "\tGoes to Target: " identifier (targetObj)"\n"
                }
}

 


2. If internal links could be in any link module - then you could use code like the following to isolate internal links from all other links

 

 

Module    m = current
Object  sourceObj, targetObj
Link    l
string  internalLinkModName = "*" //wildcard for all link modules
ModuleVersion targetModVersion = null
ModuleVersion sourceModVersion = null
 
for sourceObj in m do { //for all visible objects (display set) in the current module
 
        for l in all (sourceObj->internalLinkModName) do { //for all out going links
                targetModVersion = targetVersion l
                sourceModVersion = sourceVersion l
                if (sourceModVersion == targetModVersion) { //if the target module is the same as the source then it must be internal
                      targetObj = target l
                      print "Source of Internal Link: " identifier(sourceObj) "\tGoes to Target: " identifier (targetObj)"\n"
                        }
                }
}

 

 


Paul Miller
Melbourne, Australia

 

Re: Trace / Impact DXL for Internal Links Only
NCThiele - Mon Mar 14 18:15:26 EDT 2011

Thanks Paul - your suggestions (as provided verbatim) sort of worked for me. Instead I grabbed the "if (sourceModVersion == targetModVersion)" statement and wrapped it around the relevant content of the stock standard impact_all_recursive.inc and trace_all_recursive.inc files and it worked a treat. Thanks for providing the inspiration!

eg for out links:

// prevent dxl timeout dialog
pragma runLim, 0
// includes
#include <c:/Program Files/Telelogic/DOORS_8.3/lib/dxl/layout/actual/common.inc>

// constants
const string S_LINK_MODULE = "*"
const string S_INITIAL_INDENT = ""
const string S_LEVEL_INDENT = " "
// constants
const int I_MAX_DEPTH = 0
// globals
Skip g_skpLinkedObjects = create
void fnRecursiveOutlink(Object o, int iDepth, string sIndent)
{
// only relevant if object has not been handled
if (find(g_skpLinkedObjects, o) == false)
{
Link l

put(g_skpLinkedObjects, o, o)

// process out-links
int iSavedDepth = iDepth
for l in all(o -> S_LINK_MODULE) do
{
ModuleVersion targetVer = targetVersion(l)
ModuleVersion sourceVer = sourceVersion(l)

if (sourceVer == targetVer)
{

// only relevant if module exists with r access
if (exists(module targetVer))
{
// ensure module is open
if (null data(targetVer))
{
Module m = load(targetVer, false)

if (m != null && g_skpLayoutDXLOutLinkModulesOpened != null)
{
// add to skip
put(g_skpLayoutDXLOutLinkModulesOpened, m, m)
}
}

Object oTarget = target l

// check status
if (oTarget != null)
{
displayRich sIndent "-> {\\b " baselineName(targetVer) ":} Object " identifier(oTarget) " (through {\\i " fullName(module l) "})"

// check status
if (I_MAX_DEPTH == 0 || --iDepth > 0)
{
// call recursively
fnRecursiveOutlink(oTarget, iDepth, sIndent S_LEVEL_INDENT)
}
}
}
iDepth = iSavedDepth
}
}
delete(g_skpLinkedObjects, o)
}

}
// process out-links
{
fnRecursiveOutlink(obj, I_MAX_DEPTH, S_INITIAL_INDENT)

if (isLastObjectInDXLSet(obj)){
// Need to keep skip list of open modules a la suspect links?
// Need to close them all once we're done.
fnCloseModules(g_skpLayoutDXLOutLinkModulesOpened)
}
// delete skip
delete g_skpLinkedObjects
}